HL7 v2
HL7 version 2 is the messaging standard that most hospital systems still use to talk to each other. It predates the web, and it is nowhere near disappearing: laboratory analysers, radiology systems, admission systems and hospital information systems exchange v2 messages every day.
Anyone doing healthcare integration work meets v2 before they meet FHIR.
The shape of a message
A v2 message is pipe-delimited text, one segment per line:
MSH|^~\&|LIS|LAB|HIS|HOSPITAL|20260115093000||ORU^R01|MSG00001|P|2.5.1
PID|1||12345^^^HOSPITAL^MR||DEVKOTA^SITA||19900412|F
OBR|1||LAB98765|718-7^Hemoglobin^LN
OBX|1|NM|718-7^Hemoglobin^LN||11.2|g/dL|12.0-15.5|L|||F
- MSH — message header: sender, receiver, timestamp, message type, version
- PID — patient identification
- OBR — observation request (the order)
- OBX — observation result (one per result value)
Each segment is a sequence of fields (|), components (^), and repetitions
(~), with \& for sub-components.
Trigger events
Messages are named by event: something happened, so a message is sent.
| Message | Event |
|---|---|
ADT^A01 | Patient admitted |
ADT^A03 | Patient discharged |
ADT^A08 | Patient information updated |
ORM^O01 | Order placed |
ORU^R01 | Observation result available |
SIU^S12 | Appointment scheduled |
Delivery is usually over MLLP (Minimal Lower Layer Protocol) on a TCP
socket, with an ACK message confirming receipt.
Why it is difficult
- Optionality. Large parts of the standard are optional, so every deployment is a local dialect. "HL7 v2 compliant" tells you very little.
- Z-segments. Vendors add custom
Z*segments for anything the standard does not cover — undocumented as often as not. - Thin semantics. The standard describes structure far more than meaning; terminology binding is inconsistent.
- Interface count. Point-to-point interfaces grow as n², which is the problem integration engines exist to solve.
v2 and FHIR together
FHIR does not delete v2 — it wraps it. A common architecture:
Lab analyser → HL7 v2 (MLLP) → integration engine → FHIR resources → FHIR server
The engine handles transport, mapping, terminology translation and error handling; downstream consumers only ever see FHIR. Mappings between v2 segments and FHIR resources are published by HL7, but local dialects still require local mapping work.
Practical advice
- Get the real messages before estimating. The vendor's spec and the messages on the wire differ more often than not.
- Log everything, including rejects. v2 failures are silent by default.
- Pin the version (2.3, 2.5.1, 2.7 …) per interface.
- Treat identifiers carefully —
PID-3assigning authorities are where patient matching succeeds or fails.
References
- HL7 International — https://www.hl7.org/implement/standards/
- Integration engines for routing and transformation
- HL7 FHIR for modern exchange